﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master"
    CodeBehind="DiscussionForum.aspx.vb" Inherits="VW_Passat_Community.DiscussionForum" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .discussionInformation
        {
            height: 930px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="bluecontent">
        <h1 class="headline3">
            Discussion Forum</h1>
        <p>
            Post all of your Volkswagen Passat related questions and receive answers from our
            users &amp; industry experts.<br />
            <br />
            Thousands of our users login everyday to posts discussions and give answers too,
            its free help and guidance only for you!!!
            <br />
        </p>
    </div>
    <br />
    <div class="discussionInformation">
        <div class="addingNewDiscussion">
            <div class="addingNewDiscussion2">
                <asp:TextBox ID="txtmaintenancedescription" runat="server" CssClass="textboxnormal"
                    Height="61px" TextMode="MultiLine" Width="362px"></asp:TextBox>
                <asp:TextBoxWatermarkExtender ID="txtmaintenancedescription_TextBoxWatermarkExtender"
                    runat="server" Enabled="True" TargetControlID="txtmaintenancedescription" WatermarkText="To add a new discussion to this page, just enter the title of the discussion in this text box  and click 'Submit'. ">
                </asp:TextBoxWatermarkExtender>
                <br />
                <asp:Button ID="btnsubmit" runat="server" Height="31px" Text="Submit" Width="93px"
                    CssClass="buttons" />
                <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
                </asp:ToolkitScriptManager>
                <br />
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtmaintenancedescription"
                    ErrorMessage="The discussion box is empty, please enter the title of a discussion and press submit."
                    Font-Bold="True" Font-Italic="True" ForeColor="Red"></asp:RequiredFieldValidator>
            </div>
        </div>
        <br />
        <%--  <div class="discussion">--%>
        <div class="buildList">
            <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" Style="font-size: small;
                font-family: Calibri">
                <AlternatingItemTemplate>
                    <span>
                        <h3 class="headline4">
                            <a href="MyVolkswagen.aspx?Username=<%# Eval("UserName") %>">
                                <img alt="Picture" width="60" height="70" src='<%# Eval("UserImage")%>' />
                            </a>Title: <a href="AddPosts.aspx?id=<%# Eval("DiscussionID") %>">
                                <asp:Label ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                            </a>
                        </h3>
                        <br />
                        <strong>Date Discussion Created:</strong>
                        <asp:Label ID="DateCreatedLabel" runat="server" Text='<%# Eval("DateCreated") %>' />
                        <br />
                        <strong>Created by:</strong> <a href="MyVolkswagen.aspx?Username=<%# Eval("UserName") %>">
                            <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                        <br />
                        <br />
                    </span>
                </AlternatingItemTemplate>
                <EditItemTemplate>
                    <span>DiscussionID:
                        <asp:Label ID="DiscussionIDLabel1" runat="server" Text='<%# Eval("DiscussionID") %>' />
                        <h3 class="headline4">
                           <a href="MyVolkswagen.aspx?Username=<%# Eval("UserName") %>">
                                <img alt="Picture" width="60" height="70" src='<%# Eval("UserImage")%>' />
                            </a>Title:
                            <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                        </h3>
                        <strong>Date Discussion Created:</strong>
                        <asp:TextBox ID="DateCreatedTextBox" runat="server" Text='<%# Bind("DateCreated") %>' />
                        <br />
                        <strong>Created by:</strong> <a href="MyVolkswagen.aspx?Username=<%# Eval("UserName") %>">
                            <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                        <br />
                        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
                        <br />
                        <br />
                    </span>
                </EditItemTemplate>
                <EmptyDataTemplate>
                    <span>No data was returned.</span>
                </EmptyDataTemplate>
                <InsertItemTemplate>
                    <span>DiscussionID:
                        <asp:Label ID="DiscussionIDLabel1" runat="server" Text='<%# Eval("DiscussionID") %>' />
                        <h3 class="headline4">
                            <a href="MyVolkswagen.aspx?Username=<%# Eval("UserName") %>">
                                <img alt="Picture" width="60" height="70" src='<%# Eval("UserImage")%>' />
                            </a>Title:
                            <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                        </h3>
                        <strong>Date Discussion Created:</strong>
                        <asp:TextBox ID="DateCreatedTextBox" runat="server" Text='<%# Bind("DateCreated") %>' />
                        <br />
                        <strong>Created by:</strong> <a href="MyVolkswagen.aspx?Username=<%# Eval("UserName") %>">
                            <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                        <br />
                        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
                        <br />
                        <br />
                    </span>
                </InsertItemTemplate>
                <ItemTemplate>
                    <span>
                        <h3 class="headline4">
                          <%--  <a href="MyVolkswagen.aspx?Username=<%# Eval("UserName") %>">
                                <img alt="Picture" width="60" height="70" src='<%# Eval("UserImage")%>' />--%>
                            </a>Title: <a href="AddPosts.aspx?id=<%# Eval("DiscussionID") %>">
                                <asp:Label ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                            </a>
                        </h3>
                        <strong>Date Discussion Created:</strong>
                        <asp:Label ID="DateCreatedLabel" runat="server" Text='<%# Eval("DateCreated") %>' />
                        <br />
                        <strong>Created by:</strong> <a href="MyVolkswagen.aspx?Username=<%# Eval("UserName") %>">
                            <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                        <br />
                        <br />
                    </span>
                </ItemTemplate>
                <LayoutTemplate>
                    <div id="itemPlaceholderContainer" runat="server" style="font-family: Verdana, Arial, Helvetica, sans-serif;">
                        <span runat="server" id="itemPlaceholder" />
                    </div>
                    <div style="text-align: center; background-color: #CCCCCC; font-family: Verdana, Arial, Helvetica, sans-serif;
                        color: #000000;">
                        <asp:DataPager ID="DataPager1" runat="server" PagedControlID="ListView1" PageSize="5">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False"
                                    ShowPreviousPageButton="False" />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False"
                                    ShowPreviousPageButton="False" />
                            </Fields>
                        </asp:DataPager>
                    </div>
                </LayoutTemplate>
                <SelectedItemTemplate>
                    <span style="background-color: #008A8C; color: #FFFFFF;">DiscussionID:
                        <asp:Label ID="DiscussionIDLabel1" runat="server" Text='<%# Eval("DiscussionID") %>' />
                        <br />
                        <h3 class="headline5">
                            <a href="MyVolkswagen.aspx?Username=<%# Eval("UserName") %>">
                                <img alt="Picture" width="60" height="70" src='<%# Eval("UserImage")%>' />
                            </a>Title:
                            <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                        </h3>
                        <strong>Date Discussion Created:</strong>
                        <asp:TextBox ID="DateCreatedTextBox" runat="server" Text='<%# Bind("DateCreated") %>' />
                        <br />
                        <strong>Created by:</strong>
                        <asp:TextBox ID="UserNameTextBox" runat="server" Text='<%# Bind("UserName") %>' />
                        <br />
                        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
                        <br />
                        <br />
                    </span>
                </SelectedItemTemplate>
            </asp:ListView>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT Discussion.DiscussionID, Discussion.Title, Discussion.DateCreated, aspnet_Users.UserName, UserProfile.UserImage FROM ((Discussion INNER JOIN aspnet_Users ON Discussion.UserIDFK = aspnet_Users.UserId) INNER JOIN UserProfile ON aspnet_Users.UserName = UserProfile.Username) GROUP BY Discussion.Title, Discussion.DateCreated, Discussion.DiscussionID, aspnet_Users.UserName, UserProfile.UserImage ORDER BY Discussion.DiscussionID DESC">
            </asp:SqlDataSource>
        </div>
    </div>
</asp:Content>
